package com.jinxin.platform.cdacsrecord.core.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jinxin.platform.cdacsrecord.core.pojo.domains.*;
import com.jinxin.platform.cdacsrecord.core.pojo.entity.CommonCodeEntity;
import com.jinxin.platform.cdacsrecord.core.pojo.entity.ResultEntity;
import com.jinxin.platform.cdacsrecord.core.pojo.vo.DataResult2;
import com.jinxin.platform.cdacsrecord.core.service.JurenAcsCaptureRecordService;
import com.jinxin.platform.cdacsrecord.core.service.RestTemplateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * All rights Reserved, Designed By www.beonelot.com
 *
 * @version: V1.0
 * @Copyright: www.beonelot.com Inc. All rights reserved.
 * @Description：
 * @Date: 2020-07-31
 * @Author: Lingnan
 **/
@RestController
@RequestMapping("/captureRecord")
@Slf4j
public class CaptureRecordController {
    @Autowired
    private RestTemplateService restTemplateService;
    @Autowired
    private JurenAcsCaptureRecordService captureRecordService;

    @RequestMapping("/list")
    public Map<String,Object> list(@RequestParam long page, @RequestParam long limit,
                                   String lockName, String startDate,String endDate,String companyId){
        HashMap param = new HashMap();
        param.put("page", page);
        param.put("limit", limit);
        param.put("lockName", lockName);
        param.put("startDate", startDate);
        param.put("endDate", endDate);
        param.put("companyId", companyId);
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("code",0);
        resultMap.put("msg","");
        resultMap.put("count",captureRecordService.listPageCount(param));
        resultMap.put("data",captureRecordService.listPage(param));
        return resultMap;
    }

    @PostMapping("updateData")
    public ResultEntity updateData(String companyId,String startDate, String endDate){
        return captureRecordService.updateData(companyId,startDate,endDate);

    }

}
